﻿using System.Collections.Generic;
using BlueDot.Data.Core;

namespace CreateDatabaseFromEntities.Data.Entities
{
    public class User : Entity
    {
        #region Fields

        public const string BlogsColumnName = "Blogs";
        public const string FirstNameColumnName = "FirstName";
        public const string LastNameColumnName = "LastName";
        public const string UserIDColumnName = "UserID";

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the blogs.
        /// Relationship attribute defines the relationship between User and Blogs.
        /// The RelationshipType defines the type of relationship.
        /// </summary>
        /// <value>The blogs.</value>
        [Relationship(RelationshipType = RelationShipTypes.OneToMany)]
        public List<Blog> Blogs { get; set; }

        /// <summary>
        /// Gets or sets the first name.
        /// Size: Defines the length of the field when the database is created.
        /// IsRequried: Defines this as a required property and will be set to NOT NULL in the database
        /// </summary>
        /// <value>The first name.</value>
        [Property(MaxLength = 50, IsRequired = true)]
        public string FirstName { get; set; }

        /// <summary>
        /// Gets or sets the last.
        /// Size: Defines the length of the field when the database is created.
        /// IsRequried: Defines this as a required property and will be set to NOT NULL in the database
        /// </summary>
        /// <value>The last.</value>
        [Property(MaxLength = 50, IsRequired = true)]
        public string LastName { get; set; }

        /// <summary>
        /// Gets or sets the user ID.
        /// IsUniqueKey: Defines this property as the UniqueKey (Primary Key)
        /// IsGenerated: Defines this property is gernerated by the database. Since
        /// the dataType is an int the DB provider will create the field as an Identity field
        /// </summary>
        /// <value>The user ID.</value>
        [Property(IsUniqueKey = true, IsGenerated = true)]
        public int UserID { get; set; }

        #endregion
    }
}